package com.chuangyi.config.server.controller;

import com.cclifetech.common.web.Message;
import com.chuangyi.config.server.manager.ConfigManager;
import org.springframework.http.HttpEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by fangtao on 2017/6/4.
 */
@RestController
@RequestMapping("/namespaces/{namespace}/configs")
public class ConfigController {
    @Resource
    private ConfigManager configManager;

    @DeleteMapping("/{key}")
    public ResponseEntity delete(@PathVariable("namespace") String namespace, @PathVariable("key") String key) {
        configManager.delete(namespace, key);
        return ResponseEntity.ok(Message.EMPTY);
    }
}
